package studentfunction;

import student.StudenList;
import student.Student;

import java.util.Scanner;

public class AlterFunction implements IFunction {//修改

    @Override
    public void work(StudenList studenList) {
        System.out.println("修改学生信息");
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入要修改的学生姓名");
        String name1=scanner.nextLine();
        Student tmp=null;
        int currentSize=studenList.getUsedsize();
        for (int i = 0; i < currentSize; i++) {
            if (studenList.getStudent(i).getName()==name1){
                tmp=studenList.getStudent(i);
                break;
            }
        }
        System.out.println("输入学生姓名：");
        String name = scanner.nextLine();
        System.out.println("输入性别：");
        String sex = scanner.nextLine();
        System.out.println("输入班级：");
        String clas = scanner.nextLine();
        System.out.println("输入学号：");
        int schoolNuber = scanner.nextInt();
        Student student=new Student(name,sex,clas,schoolNuber);//新的学生信息
        tmp= student;//放入原来位置
        System.out.println("修改完成");
    }
}
